<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>支持我们 - 打赏界面</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Helvetica Neue', Arial, sans-serif;
        }
        
        body {
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }
        
        .container {
            background: white;
            border-radius: 16px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            width: 100%;
            max-width: 500px;
            overflow: hidden;
        }
        
        .header {
            background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 25px;
            text-align: center;
        }
        
        .header h1 {
            font-size: 24px;
            margin-bottom: 8px;
        }
        
        .header p {
            opacity: 0.9;
        }
        
        .content {
            padding: 25px;
        }
        
        .options {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 15px;
            margin-bottom: 25px;
        }
        
        .option {
            border: 2px solid #e1e5eb;
            border-radius: 12px;
            padding: 20px 15px;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s ease;
        }
        
        .option:hover {
            transform: translateY(-3px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }
        
        .option.selected {
            border-color: #667eea;
            background-color: #f0f3ff;
        }
        
        .option .amount {
            font-size: 22px;
            font-weight: bold;
            color: #333;
            margin-bottom: 5px;
        }
        
        .option .description {
            font-size: 14px;
            color: #666;
        }
        
        .payment-methods {
            margin-bottom: 25px;
        }
        
        .payment-methods h3 {
            font-size: 16px;
            margin-bottom: 15px;
            color: #444;
        }
        
        .methods {
            display: flex;
            gap: 15px;
        }
        
        .method {
            flex: 1;
            border: 2px solid #e1e5eb;
            border-radius: 10px;
            padding: 15px;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s ease;
        }
        
        .method:hover {
            border-color: #667eea;
        }
        
        .method.selected {
            border-color: #667eea;
            background-color: #f0f3ff;
        }
        
        .method img {
            height: 30px;
            margin-bottom: 8px;
        }
        
        .method .name {
            font-size: 14px;
            color: #444;
        }
        
        .custom-amount {
            margin-bottom: 25px;
        }
        
        .custom-amount h3 {
            font-size: 16px;
            margin-bottom: 15px;
            color: #444;
        }
        
        .amount-input {
            display: flex;
            align-items: center;
            border: 2px solid #e1e5eb;
            border-radius: 10px;
            overflow: hidden;
        }
        
        .currency {
            padding: 0 15px;
            background: #f5f7fa;
            height: 50px;
            display: flex;
            align-items: center;
            font-weight: bold;
            color: #555;
        }
        
        .amount-input input {
            flex: 1;
            border: none;
            padding: 0 15px;
            height: 50px;
            font-size: 16px;
            outline: none;
        }
        
        .btn-submit {
            background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 10px;
            padding: 16px;
            font-size: 16px;
            font-weight: bold;
            width: 100%;
            cursor: pointer;
            transition: all 0.3s ease;
        }
        
        .btn-submit:hover {
            opacity: 0.9;
            transform: translateY(-2px);
        }
        
        .message {
            text-align: center;
            margin-top: 20px;
            font-size: 14px;
            color: #666;
        }
        
        @media (max-width: 500px) {
            .options {
                grid-template-columns: 1fr;
            }
            
            .methods {
                flex-direction: column;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>支持我们的工作</h1>
            <p>您的打赏将帮助我们持续创造优质内容</p>
        </div>
        
        <div class="content">
            <form action="process_donation.php" method="POST" id="donationForm">
                <div class="options">
                    <div class="option" data-amount="5">
                        <div class="amount">5元</div>
                        <div class="description">表示感谢</div>
                    </div>
                    <div class="option" data-amount="10">
                        <div class="amount">10元</div>
                        <div class="description">点赞鼓励</div>
                    </div>
                    <div class="option" data-amount="20">
                        <div class="amount">20元</div>
                        <div class="description">大力支持</div>
                    </div>
                    <div class="option" data-amount="50">
                        <div class="amount">50元</div>
                        <div class="description">超级认可</div>
                    </div>
                </div>
                
                <div class="payment-methods">
                    <h3>选择支付方式</h3>
                    <div class="methods">
                        <div class="method" data-method="wechat">
                            <img src="" alt="微信支付">
                            <div class="name">微信支付</div>
                        </div>
                        <div class="method" data-method="alipay">
                            <img src="" alt="支付宝">
                            <div class="name">支付宝</div>
                        </div>
                    </div>
                </div>
                
                <div class="custom-amount">
                    <h3>或输入自定义金额</h3>
                    <div class="amount-input">
                        <div class="currency">¥</div>
                        <input type="number" name="amount" id="customAmount" placeholder="输入金额" min="1" step="0.01">
                    </div>
                </div>
                
                <input type="hidden" name="selected_amount" id="selectedAmount" value="">
                <input type="hidden" name="payment_method" id="paymentMethod" value="">
                
                <button type="submit" class="btn-submit">立即打赏</button>
                
                <div class="message">
                    感谢您的支持！
                </div>
            </form>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // 选项选择
            const options = document.querySelectorAll('.option');
            let selectedOption = null;
            
            options.forEach(option => {
                option.addEventListener('click', function() {
                    // 移除之前的选择
                    if (selectedOption) {
                        selectedOption.classList.remove('selected');
                    }
                    
                    // 设置新的选择
                    this.classList.add('selected');
                    selectedOption = this;
                    
                    // 更新隐藏字段和自定义输入
                    const amount = this.getAttribute('data-amount');
                    document.getElementById('selectedAmount').value = amount;
                    document.getElementById('customAmount').value = amount;
                });
            });
            
            // 支付方式选择
            const methods = document.querySelectorAll('.method');
            let selectedMethod = null;
            
            methods.forEach(method => {
                method.addEventListener('click', function() {
                    // 移除之前的选择
                    if (selectedMethod) {
                        selectedMethod.classList.remove('selected');
                    }
                    
                    // 设置新的选择
                    this.classList.add('selected');
                    selectedMethod = this;
                    
                    // 更新隐藏字段
                    const methodName = this.getAttribute('data-method');
                    document.getElementById('paymentMethod').value = methodName;
                });
            });
            
            // 自定义金额输入
            const customAmountInput = document.getElementById('customAmount');
            customAmountInput.addEventListener('input', function() {
                // 如果输入了自定义金额，取消选项的选择
                if (selectedOption) {
                    selectedOption.classList.remove('selected');
                    selectedOption = null;
                }
                
                document.getElementById('selectedAmount').value = this.value;
            });
            
            // 表单提交验证
            document.getElementById('donationForm').addEventListener('submit', function(e) {
                const amount = document.getElementById('selectedAmount').value;
                const method = document.getElementById('paymentMethod').value;
                
                if (!amount || amount <= 0) {
                    e.preventDefault();
                    alert('请选择或输入打赏金额');
                    return;
                }
                
                if (!method) {
                    e.preventDefault();
                    alert('请选择支付方式');
                    return;
                }
            });
        });
    </script>
</body>
</html>